﻿using LibNiconico.NiconicoApi.Extentions;
using LibNiconico.NiconicoApi.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LibNiconico.NiconicoApi.Alert
{
    internal class NicoAlertApiLoginQueryInfo:NicoUrlEncodedPostAble
    {
        internal string Mail { get; private set; }

        internal string Password { get; private set; }

        internal NicoAlertApiLoginQueryInfo(string mail, string password)
        {
            this.Mail = mail;
            this.Password = password;
        }

        internal override byte[] AsPostData()
        {
            var queryStrings = new QueryStrings();
            queryStrings.Add(PostName.MAIL, this.Mail);
            queryStrings.Add(PostName.PASSWORD, this.Password);

            return Encoding.UTF8.GetBytes(queryStrings.ToString());
        }

        internal override string AsPath()
        {
            return "secure/login";
        }

        internal override string AsQuery()
        {
            return "site=nicolive_antenna";
        }


        private static class PostName
        {
            internal const string MAIL = "mail";

            internal const string PASSWORD = "password";
        }

    }
}
